<!--河南星辰软件科技有限公司
@copyright Copyright (c) 2010~2022 All rights reserved.
-->
<template>
  <div class='app-container'>
    <el-form ref="form" :model="s_recod" :rules="rules" label-width="100px" id="mvcfm">
      <el-button @click="popSearchPro('')" type='success' size="mini"><i class='fa fa-plus'></i>增加物料</el-button>
      <div class="form-unit">
        <span class="mvc-title-left"> 物料列表 </span>
      </div>
      <el-table :data="s_recod">
        <el-table-column label="操作" align="center" width='100' type=''>
          <template slot-scope="scope">
            <el-dropdown trigger="click">
              <span class="el-dropdown-link">操作<i class="el-icon-arrow-down el-icon--right"></i></span>
              <el-dropdown-menu slot="dropdown">
                <el-dropdown-item>
                  <el-link @click="d_store('&CMID4='+scope.row.recod_id+'')">删除</el-link>
                </el-dropdown-item>
                <el-dropdown-item>
                  <el-link @click="popReplaceLib('&CMIDrecod_id='+scope.row.recod_id+'')">替换库管员</el-link>
                </el-dropdown-item>
              </el-dropdown-menu>
            </el-dropdown>
          </template>
        </el-table-column>
        <el-table-column label="#" align="center" type='index'>
        </el-table-column>
        <el-table-column label="产品条形码" prop="product_barcode">
        </el-table-column>
        <el-table-column label="产品名称" prop="product_name">
        </el-table-column>
        <el-table-column label="规格型号" prop="norm_model">
        </el-table-column>
        <el-table-column label="产品厂家" prop="client_name">
        </el-table-column>
        <el-table-column label="库存位置" prop="name">
        </el-table-column>
        <el-table-column label="仓管员" prop="role">
        </el-table-column>
        <el-table-column label="库管员" prop="contact_name">
        </el-table-column>
      </el-table>
    </el-form>
    <el-dialog :visible.sync="SearchProVisible" append-to-body>
      <SearchPro v-if="SearchProVisible" ref="SearchPro" :popparams="popparams"> </SearchPro>
    </el-dialog>
    <el-dialog :visible.sync="ReplaceLibVisible" append-to-body>
      <ReplaceLib v-if="ReplaceLibVisible" ref="ReplaceLib" :popparams="popparams"> </ReplaceLib>
    </el-dialog>
  </div>
</template>
<script>
  import request from '@/utils/request'
  import SearchPro from "@/views/psi/supplychainmana/SearchPro";
  import ReplaceLib from "@/views/psi/supplychainmana/ReplaceLib";
  export default {
    name: 'InventoryPro',
    components: {
      SearchPro,
      ReplaceLib,
    },
    props: ['popparams'],
    data() {
      return {
        SearchProVisible: false,
        SearchProValue: null,
        SearchProDesc: null,
        ReplaceLibVisible: false,
        ReplaceLibValue: null,
        ReplaceLibDesc: null,
        vueparams: this.getVUEParams(""),
        s_recod: [],
        loading: false,
        rules: {}
      }
    },
    created() {
      this.getData();
    },
    updated() {},
    mounted() {},
    methods: {
      getData() {
        request({
          method: 'get',
          url: '/xcapi/VUEAction/psi/main/InventoryAction/inventoryPro?' + this.vueparams,
        }).then(data => {
          for (var k in data) {
            if (Array.isArray(data[k])) {
              this[k] = data[k];
            } else {
              $.extend(this[k], data[k]);
            }
          }
        })
      },
      popSearchPro(params) {
        if (params != "") this.popparams = params + this.vueparams;
        this.SearchProVisible = !this.SearchProVisible;
      },
      popReplaceLib(params) {
        if (params != "") this.popparams = params + this.vueparams;
        this.ReplaceLibVisible = !this.ReplaceLibVisible;
      },
    },
  }
</script>
